﻿using System.Collections;
namespace com.fukefu.source
{
    static class ContentType
    {
        private static Hashtable hs = new Hashtable();
        static ContentType()
        {
            hs.Add(".*", "application/octet-stream");
            hs.Add(".001", "application/x-001");
            hs.Add(".301", "application/x-301");
            hs.Add(".323", "text/h323");
            hs.Add(".906", "application/x-906");
            hs.Add(".907", "drawing/907");
            hs.Add(".a11", "application/x-a11");
            hs.Add(".acp", "audio/x-mei-aac");
            hs.Add(".ai", "application/postscript");
            hs.Add(".aif", "audio/aiff");
            hs.Add(".aifc", "audio/aiff");
            hs.Add(".aiff", "audio/aiff");
            hs.Add(".anv", "application/x-anv");
            hs.Add(".asa", "text/asa");
            hs.Add(".asf", "video/x-ms-asf");
            hs.Add(".asp", "text/asp");
            hs.Add(".asx", "video/x-ms-asf");
            hs.Add(".au", "audio/basic");
            hs.Add(".avi", "video/avi");
            hs.Add(".awf", "application/vnd.adobe.workflow");
            hs.Add(".biz", "text/xml");
            hs.Add(".bmp", "application/x-bmp");
            hs.Add(".bot", "application/x-bot");
            hs.Add(".c4t", "application/x-c4t");
            hs.Add(".c90", "application/x-c90");
            hs.Add(".cal", "application/x-cals");
            hs.Add(".cat", "application/vnd.ms-pki.seccat");
            hs.Add(".cdf", "application/x-netcdf");
            hs.Add(".cdr", "application/x-cdr");
            hs.Add(".cel", "application/x-cel");
            hs.Add(".cer", "application/x-x509-ca-cert");
            hs.Add(".cg4", "application/x-g4");
            hs.Add(".cgm", "application/x-cgm");
            hs.Add(".cit", "application/x-cit");
            hs.Add(".class", "java/*");
            hs.Add(".cml", "text/xml");
            hs.Add(".cmp", "application/x-cmp");
            hs.Add(".cmx", "application/x-cmx");
            hs.Add(".cot", "application/x-cot");
            hs.Add(".crl", "application/pkix-crl");
            hs.Add(".crt", "application/x-x509-ca-cert");
            hs.Add(".csi", "application/x-csi");
            hs.Add(".css", "text/css");
            hs.Add(".cut", "application/x-cut");
            hs.Add(".dbf", "application/x-dbf");
            hs.Add(".dbm", "application/x-dbm");
            hs.Add(".dbx", "application/x-dbx");
            hs.Add(".dcd", "text/xml");
            hs.Add(".dcx", "application/x-dcx");
            hs.Add(".der", "application/x-x509-ca-cert");
            hs.Add(".dgn", "application/x-dgn");
            hs.Add(".dib", "application/x-dib");
            hs.Add(".dll", "application/x-msdownload");
            hs.Add(".doc", "application/msword");
            hs.Add(".dot", "application/msword");
            hs.Add(".drw", "application/x-drw");
            hs.Add(".dtd", "text/xml");
            hs.Add(".dwg", "application/x-dwg");
            hs.Add(".dxb", "application/x-dxb");
            hs.Add(".dxf", "application/x-dxf");
            hs.Add(".edn", "application/vnd.adobe.edn");
            hs.Add(".emf", "application/x-emf");
            hs.Add(".eml", "message/rfc822");
            hs.Add(".ent", "text/xml");
            hs.Add(".epi", "application/x-epi");
            hs.Add(".etd", "application/x-ebx");
            hs.Add(".exe", "application/x-msdownload");
            hs.Add(".fax", "image/fax");
            hs.Add(".fdf", "application/vnd.fdf");
            hs.Add(".fif", "application/fractals");
            hs.Add(".fo", "text/xml");
            hs.Add(".frm", "application/x-frm");
            hs.Add(".g4", "application/x-g4");
            hs.Add(".gbr", "application/x-gbr");
            hs.Add(".gcd", "application/x-gcd");
            hs.Add(".gif", "image/gif");
            hs.Add(".gl2", "application/x-gl2");
            hs.Add(".gp4", "application/x-gp4");
            hs.Add(".hgl", "application/x-hgl");
            hs.Add(".hmr", "application/x-hmr");
            hs.Add(".hpg", "application/x-hpgl");
            hs.Add(".hpl", "application/x-hpl");
            hs.Add(".hqx", "application/mac-binhex40");
            hs.Add(".hrf", "application/x-hrf");
            hs.Add(".hta", "application/hta");
            hs.Add(".htc", "text/x-component");
            hs.Add(".htm", "text/html");
            hs.Add(".html", "text/html");
            hs.Add(".htt", "text/webviewhtml");
            hs.Add(".htx", "text/html");
            hs.Add(".icb", "application/x-icb");
            hs.Add(".iff", "application/x-iff");
            hs.Add(".ig4", "application/x-g4");
            hs.Add(".igs", "application/x-igs");
            hs.Add(".iii", "application/x-iphone");
            hs.Add(".img", "application/x-img");
            hs.Add(".ins", "application/x-internet-signup");
            hs.Add(".isp", "application/x-internet-signup");
            hs.Add(".IVF", "video/x-ivf");
            hs.Add(".java", "java/*");
            hs.Add(".jfif", "image/jpeg");
            hs.Add(".jpe", "image/jpeg");
            hs.Add(".jpeg", "image/jpeg");
            hs.Add(".jpg", "image/jpeg");
            hs.Add(".js", "application/x-javascript");
            hs.Add(".jsp", "text/html");
            hs.Add(".la1", "audio/x-liquid-file");
            hs.Add(".lar", "application/x-laplayer-reg");
            hs.Add(".latex", "application/x-latex");
            hs.Add(".lavs", "audio/x-liquid-secure");
            hs.Add(".lbm", "application/x-lbm");
            hs.Add(".lmsff", "audio/x-la-lms");
            hs.Add(".ls", "application/x-javascript");
            hs.Add(".ltr", "application/x-ltr");
            hs.Add(".m1v", "video/x-mpeg");
            hs.Add(".m2v", "video/x-mpeg");
            hs.Add(".m3u", "audio/mpegurl");
            hs.Add(".m4e", "video/mpeg4");
            hs.Add(".mac", "application/x-mac");
            hs.Add(".man", "application/x-troff-man");
            hs.Add(".math", "text/xml");
            hs.Add(".mfp", "application/x-shockwave-flash");
            hs.Add(".mht", "message/rfc822");
            hs.Add(".mhtml", "message/rfc822");
            hs.Add(".mi", "application/x-mi");
            hs.Add(".mid", "audio/mid");
            hs.Add(".midi", "audio/mid");
            hs.Add(".mil", "application/x-mil");
            hs.Add(".mml", "text/xml");
            hs.Add(".mnd", "audio/x-musicnet-download");
            hs.Add(".mns", "audio/x-musicnet-stream");
            hs.Add(".mocha", "application/x-javascript");
            hs.Add(".movie", "video/x-sgi-movie");
            hs.Add(".mp1", "audio/mp1");
            hs.Add(".mp2", "audio/mp2");
            hs.Add(".mp2v", "video/mpeg");
            hs.Add(".mp3", "audio/mp3");
            hs.Add(".mp4", "video/mpeg4");
            hs.Add(".mpa", "video/x-mpg");
            hs.Add(".mpd", "application/vnd.ms-project");
            hs.Add(".mpe", "video/x-mpeg");
            hs.Add(".mpeg", "video/mpg");
            hs.Add(".mpg", "video/mpg");
            hs.Add(".mpga", "audio/rn-mpeg");
            hs.Add(".mpp", "application/vnd.ms-project");
            hs.Add(".mps", "video/x-mpeg");
            hs.Add(".mpt", "application/vnd.ms-project");
            hs.Add(".mpv", "video/mpg");
            hs.Add(".mpv2", "video/mpeg");
            hs.Add(".mpw", "application/vnd.ms-project");
            hs.Add(".mpx", "application/vnd.ms-project");
            hs.Add(".mtx", "text/xml");
            hs.Add(".mxp", "application/x-mmxp");
            hs.Add(".net", "image/pnetvue");
            hs.Add(".nrf", "application/x-nrf");
            hs.Add(".nws", "message/rfc822");
            hs.Add(".odc", "text/x-ms-odc");
            hs.Add(".out", "application/x-out");
            hs.Add(".p10", "application/pkcs10");
            hs.Add(".p12", "application/x-pkcs12");
            hs.Add(".p7b", "application/x-pkcs7-certificates");
            hs.Add(".p7c", "application/pkcs7-mime");
            hs.Add(".p7m", "application/pkcs7-mime");
            hs.Add(".p7r", "application/x-pkcs7-certreqresp");
            hs.Add(".p7s", "application/pkcs7-signature");
            hs.Add(".pc5", "application/x-pc5");
            hs.Add(".pci", "application/x-pci");
            hs.Add(".pcl", "application/x-pcl");
            hs.Add(".pcx", "application/x-pcx");
            hs.Add(".pdf", "application/pdf");
            hs.Add(".pdx", "application/vnd.adobe.pdx");
            hs.Add(".pfx", "application/x-pkcs12");
            hs.Add(".pgl", "application/x-pgl");
            hs.Add(".pic", "application/x-pic");
            hs.Add(".pko", "application/vnd.ms-pki.pko");
            hs.Add(".pl", "application/x-perl");
            hs.Add(".plg", "text/html");
            hs.Add(".pls", "audio/scpls");
            hs.Add(".plt", "application/x-plt");
            hs.Add(".png", "image/png");
            hs.Add(".pot", "application/vnd.ms-powerpoint");
            hs.Add(".ppa", "application/vnd.ms-powerpoint");
            hs.Add(".ppm", "application/x-ppm");
            hs.Add(".pps", "application/vnd.ms-powerpoint");
            hs.Add(".pr", "application/x-pr");
            hs.Add(".prf", "application/pics-rules");
            hs.Add(".prn", "application/x-prn");
            hs.Add(".prt", "application/x-prt");
            hs.Add(".ptn", "application/x-ptn");
            hs.Add(".pwz", "application/vnd.ms-powerpoint");
            hs.Add(".r3t", "text/vnd.rn-realtext3d");
            hs.Add(".ra", "audio/vnd.rn-realaudio");
            hs.Add(".ram", "audio/x-pn-realaudio");
            hs.Add(".ras", "application/x-ras");
            hs.Add(".rat", "application/rat-file");
            hs.Add(".rdf", "text/xml");
            hs.Add(".rec", "application/vnd.rn-recording");
            hs.Add(".red", "application/x-red");
            hs.Add(".rgb", "application/x-rgb");
            hs.Add(".rjs", "application/vnd.rn-realsystem-rjs");
            hs.Add(".rjt", "application/vnd.rn-realsystem-rjt");
            hs.Add(".rlc", "application/x-rlc");
            hs.Add(".rle", "application/x-rle");
            hs.Add(".rm", "application/vnd.rn-realmedia");
            hs.Add(".rmf", "application/vnd.adobe.rmf");
            hs.Add(".rmi", "audio/mid");
            hs.Add(".rmj", "application/vnd.rn-realsystem-rmj");
            hs.Add(".rmm", "audio/x-pn-realaudio");
            hs.Add(".rmp", "application/vnd.rn-rn_music_package");
            hs.Add(".rms", "application/vnd.rn-realmedia-secure");
            hs.Add(".rmvb", "application/vnd.rn-realmedia-vbr");
            hs.Add(".rmx", "application/vnd.rn-realsystem-rmx");
            hs.Add(".rnx", "application/vnd.rn-realplayer");
            hs.Add(".rp", "image/vnd.rn-realpix");
            hs.Add(".rpm", "audio/x-pn-realaudio-plugin");
            hs.Add(".rsml", "application/vnd.rn-rsml");
            hs.Add(".rt", "text/vnd.rn-realtext");
            hs.Add(".rv", "video/vnd.rn-realvideo");
            hs.Add(".sam", "application/x-sam");
            hs.Add(".sat", "application/x-sat");
            hs.Add(".sdp", "application/sdp");
            hs.Add(".sdw", "application/x-sdw");
            hs.Add(".sit", "application/x-stuffit");
            hs.Add(".slb", "application/x-slb");
            hs.Add(".sld", "application/x-sld");
            hs.Add(".slk", "drawing/x-slk");
            hs.Add(".smi", "application/smil");
            hs.Add(".smil", "application/smil");
            hs.Add(".smk", "application/x-smk");
            hs.Add(".snd", "audio/basic");
            hs.Add(".sol", "text/plain");
            hs.Add(".sor", "text/plain");
            hs.Add(".spc", "application/x-pkcs7-certificates");
            hs.Add(".spl", "application/futuresplash");
            hs.Add(".spp", "text/xml");
            hs.Add(".ssm", "application/streamingmedia");
            hs.Add(".sst", "application/vnd.ms-pki.certstore");
            hs.Add(".stl", "application/vnd.ms-pki.stl");
            hs.Add(".stm", "text/html");
            hs.Add(".sty", "application/x-sty");
            hs.Add(".svg", "text/xml");
            hs.Add(".swf", "application/x-shockwave-flash");
            hs.Add(".tdf", "application/x-tdf");
            hs.Add(".tg4", "application/x-tg4");
            hs.Add(".tga", "application/x-tga");
            hs.Add(".tiff", "image/tiff");
            hs.Add(".tld", "text/xml");
            hs.Add(".top", "drawing/x-top");
            hs.Add(".torrent", "application/x-bittorrent");
            hs.Add(".tsd", "text/xml");
            hs.Add(".txt", "text/plain");
            hs.Add(".uin", "application/x-icq");
            hs.Add(".uls", "text/iuls");
            hs.Add(".vcf", "text/x-vcard");
            hs.Add(".vda", "application/x-vda");
            hs.Add(".vdx", "application/vnd.visio");
            hs.Add(".vml", "text/xml");
            hs.Add(".vpg", "application/x-vpeg005");
            hs.Add(".vss", "application/vnd.visio");
            hs.Add(".vsw", "application/vnd.visio");
            hs.Add(".vsx", "application/vnd.visio");
            hs.Add(".vtx", "application/vnd.visio");
            hs.Add(".vxml", "text/xml");
            hs.Add(".wav", "audio/wav");
            hs.Add(".wax", "audio/x-ms-wax");
            hs.Add(".wb1", "application/x-wb1");
            hs.Add(".wb2", "application/x-wb2");
            hs.Add(".wb3", "application/x-wb3");
            hs.Add(".wbmp", "image/vnd.wap.wbmp");
            hs.Add(".wiz", "application/msword");
            hs.Add(".wk3", "application/x-wk3");
            hs.Add(".wk4", "application/x-wk4");
            hs.Add(".wkq", "application/x-wkq");
            hs.Add(".wks", "application/x-wks");
            hs.Add(".wm", "video/x-ms-wm");
            hs.Add(".wma", "audio/x-ms-wma");
            hs.Add(".wmd", "application/x-ms-wmd");
            hs.Add(".wmf", "application/x-wmf");
            hs.Add(".wml", "text/vnd.wap.wml");
            hs.Add(".wmv", "video/x-ms-wmv");
            hs.Add(".wmx", "video/x-ms-wmx");
            hs.Add(".wmz", "application/x-ms-wmz");
            hs.Add(".wp6", "application/x-wp6");
            hs.Add(".wpd", "application/x-wpd");
            hs.Add(".wpg", "application/x-wpg");
            hs.Add(".wpl", "application/vnd.ms-wpl");
            hs.Add(".wq1", "application/x-wq1");
            hs.Add(".wr1", "application/x-wr1");
            hs.Add(".wri", "application/x-wri");
            hs.Add(".wrk", "application/x-wrk");
            hs.Add(".ws", "application/x-ws");
            hs.Add(".ws2", "application/x-ws");
            hs.Add(".wsc", "text/scriptlet");
            hs.Add(".wsdl", "text/xml");
            hs.Add(".wvx", "video/x-ms-wvx");
            hs.Add(".xdp", "application/vnd.adobe.xdp");
            hs.Add(".xdr", "text/xml");
            hs.Add(".xfd", "application/vnd.adobe.xfd");
            hs.Add(".xfdf", "application/vnd.adobe.xfdf");
            hs.Add(".xhtml", "text/html");
            hs.Add(".xlw", "application/x-xlw");
            hs.Add(".xml", "text/xml");
            hs.Add(".xpl", "audio/scpls");
            hs.Add(".xq", "text/xml");
            hs.Add(".xql", "text/xml");
            hs.Add(".xquery", "text/xml");
            hs.Add(".xsd", "text/xml");
            hs.Add(".xsl", "text/xml");
            hs.Add(".xslt", "text/xml");
            hs.Add(".xwd", "application/x-xwd");
            hs.Add(".x_b", "application/x-x_b");
            hs.Add(".x_t", "application/x-x_t");
        }
        public static string GetContentType(string fileName)
        {
            if (!string.IsNullOrEmpty(fileName))
            {
                fileName = fileName.Substring(fileName.LastIndexOf("."));
                if (hs.Contains(fileName))
                {
                    return hs[fileName].ToString();
                }
            }
            return hs[".*"].ToString();
        }
    }
}
